<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<title>${retreat?.name ?: 'Unknown Retreat'} - Registration</title>
		<r:require modules="form" />
	</head>
	<body>
		<div class="content" role="main">
			<h1>${retreat?.name} Registration</h1>
			<g:if test="${flash.message}">
				<div class="message" role="status">${flash.message}</div>
			</g:if>
			<g:hasErrors bean="${registration}">
				<ul class="errors" role="alert">
					<g:eachError var="error">
						<li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
					</g:eachError>
				</ul>
			</g:hasErrors>
			<g:form action="saveRegistration">
				<fieldset class="spaced-top">
				
					<sec:ifAnyGranted roles="ROLE_ADMIN, ROLE_DIRECTOR">
						<fieldset class="fields shifted-bottom-large">
							<legend>Final Requirements</legend>
							<div class="fieldcontain ${hasErrors(bean: registration, field: 'formsSubmitted', 'error')}">
								<label for="formsSubmitted">
									<g:message code="registration.formsSubmitted.label" default="Forms Submitted?" />
								</label>
								<g:checkBox name="formsSubmitted" checked="${registration?.formsSubmitted}" />
							</div>
							
							<div class="fieldcontain ${hasErrors(bean: registration, field: 'paid', 'error')}">
								<label for="paid">
									<g:message code="registration.paid.label" default="Paid?" />
								</label>
								<g:checkBox name="paid" checked="${registration?.paid}" />
							</div>
							
							<div class="fieldcontain ${hasErrors(bean: registration, field: 'completed', 'error')}">
								<label for="completed">
									<g:message code="registration.completed.label" default="Completed?" />
								</label>
								<g:checkBox name="completed" checked="${registration?.completed}" />
							</div>
							<div>
								<input type="hidden" name="profileId" value="${registration.profile?.id}" />
							</div>
							
						</fieldset>
					</sec:ifAnyGranted>
					
					<fieldset class="fields">
						<legend>Consent and Release Agreement</legend>
						<p class="text article spaced-top spaced-bottom">Please read the following agreement in its entirety. If you are under the age of 21, have a parent or legal guardian do so for you.</p>
						<div class="agreement caption" style="height:100px;'">
							<p>In consideration for being accepted by <b>cooperating Chinese churches (Chinese Evangelical Church of Denver, Boulder Chinese Evangelical Free Church, and other associated churches, known as CCC in this section)</b> for participation in Camp Crossroads <?php echo $CAMP_YEAR . " at " . $camp_info['camp_location']; ?>, we (I), being 21 years of age or older, do for ourselves (myself) (and for and on behalf of my child-participant if said child is not 21 years of age or older) do hereby release, forever discharge and agree to hold harmless the <b>cooperating Chinese churches CCC and the directors</b> thereof from any and all liability, claims or demands for personal injury, sickness or death, as well as property damage and expenses, of any nature whatsoever which my be incurred by the undersigned and the child-participant that occurs while said child is participating in the above described trip or activity.</p>
							<p class="spaced-top">Furthermore, we (I) (and on behalf of our (my) child-participant if under the age of 21 years) hereby assume all risk of personal injury, sickness, death, damage, and expense as a result of participation in recreation and work activities involved therein.</p>
							<p class="spaced-top">Further, authorization and permission is hereby given to said church to furnish any necessary transportation, food and lodging for this participant.</p>
							<p class="spaced-top">The undersigned further herby agree to hold harmless and indemnify said church, its directors, employees, and agents for any liability sustained by said church as the result of the negligent, willful, or intentional acts of said participant, included expenses incurred attendant thereto.</p>
							<p class="spaced-top"><i>(If the participant has not attained the age of 21 years):</i></p>
							<p class="spaced-top">We (I) are the parent(s) or legal guardian(s) of this participant, and hereby grant our (my) permission for him (her) to participate fully in said trip, and hereby give our (my) permission to take said participant to a doctor or hospital and hereby authorize medical treatment, including but not in limitation to emergency surgery or medical treatment, and assume the responsibility of all medical bills, if any.</p>
							<p class="spaced-top">Further, should it be necessary for the participant to return home due to medical reasons, disciplinary action or otherwise, we (I) hereby assume all transportation costs.</p>
							<p class="spaced-top">By agreeing to these terms, I verify that I am either at least 21 years of age, am a parent of the camp participant or the legal guardian of the camp participant.
						</div>
						<div class="shifted-top tabbed-left ${hasErrors(bean: registration, field: 'signed', 'error')} required">
							<input type="checkbox" id="signed" name="signed" required="" <g:if test="${registration?.signed}">checked</g:if> /><label for="signed" class="spaced-left">I have read and agreed to the terms detailed above.</label>
						</div>
						<div class="shifted-top tabbed-left ${hasErrors(bean: registration, field: 'signed', 'error')} required">
							<label for="signer" class="spaced-right">Signed</label><input type="text" id="signer" name="signer" value="${registration?.signer}" required="" />
						</div>
					</fieldset>
					
					<g:if test="${retreat?.transportationLegs?.size() > 0}">
						<fieldset class="fields shifted-top-large">
							<legend>Transportation</legend>
							<p class="text spaced-top">
								If possible, please provide transportation to and from the following locations. If you require transportation, please indicate when transportation is needed:
							</p>
							<div class="tabbed-top force-center" style="width:50%;">
								<g:each in="${retreat.transportationLegs}" var="leg">
									<retreat:transportationRequest leg="${leg}" requested="${registration?.rideRequests?.find{ it.leg == leg}}"/>
								</g:each>
							</div>
						</fieldset>
					</g:if>
				
					<fieldset class="fields shifted-top-large">
						<legend>Emergency Information</legend>
						<p class="text spaced-top spaced-bottom">
							Enter &quot;N/A&quot; for any field that is not applicable. In case of emergency, the entered information will be used to reach the emergency contact and provided to authorities. 
						</p>
						<div class="fieldcontain ${hasErrors(bean: registration, field: 'emergencyContact', 'error')} required">
							<label for="emergencyContact">
								<g:message code="registration.emergencyContact.label" default="Emergency Contact" /> <span class="required-indicator">*</span>
							</label>
							<g:textField name="emergencyContact" required="" value="${registration?.homeChurch}" />
						</div>
						<div class="fieldcontain ${hasErrors(bean: registration, field: 'emergencyContactDayPhone', 'error')} required">
							<label for="emergencyContactDayPhone">
								<g:message code="registration.emergencyContactDayPhone.label" default="Day Phone" /> <span class="required-indicator">*</span>
							</label>
							<g:textField name="emergencyContactDayPhone" required="" value="${registration?.homeChurch}" />
						</div>
						<div class="fieldcontain ${hasErrors(bean: registration, field: 'emergencyContactNightPhone', 'error')} required">
							<label for="emergencyContactDayPhone">
								<g:message code="registration.emergencyContactNightPhone.label" default="Night Phone" /> <span class="required-indicator">*</span>
							</label>
							<g:textField name="emergencyContactNightPhone" required="" value="${registration?.emergencyContactNightPhone}" />
						</div>
						<div class="fieldcontain ${hasErrors(bean: registration, field: 'insuranceCompany', 'error')} required">
							<label for="insuranceCompany">
								<g:message code="registration.insuranceCompany.label" default="Insurance Company" /> <span class="required-indicator">*</span>
							</label>
							<g:textField name="insuranceCompany" required="" value="${registration?.insuranceCompany}" />
						</div>
						<div class="fieldcontain ${hasErrors(bean: registration, field: 'insurancePolicy', 'error')} required">
							<label for="insurancePolicy">
								<g:message code="registration.insurancePolicy.label" default="Insurance Policy" /> <span class="required-indicator">*</span>
							</label>
							<g:textField name="insurancePolicy" required="" value="${registration?.insurancePolicy}" />
						</div>
					</fieldset>
				
					<fieldset class="fields shifted-top-large">
						<legend>Other Information</legend>
						<div class="fieldcontain ${hasErrors(bean: registration, field: 'homeChurch', 'error')} required">
							<label for="homeChurch">
								<g:message code="registration.homechurch.label" default="Home Church" /> <span class="required-indicator">*</span>
							</label>
							<g:textField name="homeChurch" required="" value="${registration?.homeChurch}" />
						</div>
						
						<div class="fieldcontain ${hasErrors(bean: registration, field: 'tshirtSize', 'error')} required">
							<label for="tshirtSize">
								<g:message code="registration.tshirtSize.label" default="T-shirt Size" /><span class="required-indicator">*</span>
							</label>
							<input type="radio" name="tshirtSize" required="" value="S" ${"S".equals(registration?.tshirtSize) ? "checked" : ""}>&nbsp;Small&nbsp;&nbsp;&nbsp;&nbsp;
							<input type="radio" name="tshirtSize" required="" value="M" ${"M".equals(registration?.tshirtSize) ? "checked" : ""}>&nbsp;Medium&nbsp;&nbsp;&nbsp;&nbsp;
							<input type="radio" name="tshirtSize" required="" value="L" ${"L".equals(registration?.tshirtSize) ? "checked" : ""}>&nbsp;Large&nbsp;&nbsp;&nbsp;&nbsp;
							<input type="radio" name="tshirtSize" required="" value="XL" ${"XL".equals(registration?.tshirtSize) ? "checked" : ""}>&nbsp;Extra Large
						</div>
					</fieldset>
					
					<g:if test="${retreat?.workshops?.size() > 0}">
						<fieldset class="fields shifted-top-large">
							<legend>Workshops</legend>
							<p class="text spaced-top spaced-bottom">
								Please rank the following workshops in order according to your desire to attend. 1 is most desired. ${retreat.workshops.size()} is least desired.
							</p>
							<p class="text spaced-top spaced-bottom">
								Workshops are still being finalized. Please check back later for updates!
							</p>
							<retreat:workshopRequests requests="${registration?.workshopRequests}" workshops="${retreat.workshops}"/>
						</fieldset>
					</g:if>
					
					<fieldset class="fields shifted-top-large">
						<legend>Is there anything else you would like us to know?</legend>
						<g:textArea name="notes" value="${registration?.notes}" rows="4" style="width:98%;" />
					</fieldset>
					
					<fieldset class="fields shifted-top-large">
						<legend>Forms</legend>
						<p class="text spaced-top spaced-bottom">
							Because the camp location we attend requires hard copies of their forms, it is not possible to allow online registration for them. Please fill out all forms below and <b>return them to any counselor or director at BCEFC or CECD</b>.&nbsp;You will <u>NOT</u> be allowed to attend without these forms!
						</p>
						<div class="fieldcontain center">
							<a class="tabbed-right" target="_blank" href="http://www.campelim.com/Default.aspx?TabId=152">Health and Medical</a>
							<a class="tabbed-left" target="_blank" href="http://www.campelim.com/Registration/ReleaseUnderstanding/tabid/153/Default.aspx">Release and Understanding</a>
						</div>
					</fieldset>
					
					<input type="hidden" name="retreatId" value="${retreat?.id}" />
					<input type="hidden" name="registrationId" value="${registration?.id}" />
				</fieldset>
				<fieldset class="buttons center shifted-top-large">
					<g:submitButton name="save" class="save" value="${message(code: 'default.button.save.label', default: 'Save')}" />
					<g:if test="${registration?.id}">
						<g:actionSubmit class="delete" action="deleteRegistration" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
					</g:if>
				</fieldset>
			</g:form>
		</div>

	</body>
</html>